home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / gpp-1_42.lha / g++-1.42.0 / config.g++ < prev    next >
Text File  |  1991-10-19  |  8KB  |  364 lines

  1. #!/bin/sh
  2. # Configuration script for GNU C++
  3. #   Copyright (C) 1988 Free Software Foundation, Inc.
  4.  
  5. #This file is part of GNU CC.
  6.  
  7. #GNU CC is free software; you can redistribute it and/or modify
  8. #it under the terms of the GNU General Public License as published by
  9. #the Free Software Foundation; either version 1, or (at your option)
  10. #any later version.
  11.  
  12. #GNU CC is distributed in the hope that it will be useful,
  13. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. #GNU General Public License for more details.
  16.  
  17. #You should have received a copy of the GNU General Public License
  18. #along with GNU CC; see the file COPYING.  If not, write to
  19. #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. #
  22. # Shell script to create proper links to machine-dependent files in
  23. # preparation for compiling g++.  Also, files borrowed verbatim from
  24. # GNU CC have their links made by this program.
  25. #
  26. # Usage: config.g++ [vint] machine
  27. #
  28. # If config.g++ succeeds, it leaves its status in config.status.
  29. # If config.g++ fails after disturbing the status quo, 
  30. #     config.status is removed.
  31. #
  32.  
  33. progname=$0
  34. remove=rm
  35. hard_link=ln
  36. symbolic_link='ln -s'
  37.  
  38. #for Test
  39. #remove="echo rm"
  40. #hard_link="echo ln"
  41. #symbolic_link="echo ln -s"
  42.  
  43. for arg in $*;
  44. do
  45.   case $arg in
  46.    -srcdir=*)
  47.     srcdir=`echo $arg | sed s/-srcdir=//`
  48.     ;;
  49.    -vint)
  50.     vint=on
  51.     ;;
  52.    *)
  53.     machine=$arg
  54.     ;;
  55.   esac
  56. done
  57.  
  58. # Find the source files, if location was not specified.
  59. if [ x$srcdir = x ]
  60. then
  61.     srcdirdefaulted=1
  62.     srcdir=.
  63.     if [ ! -r tree.c ]
  64.     then
  65.         srcdir=..
  66.     fi
  67. fi
  68.  
  69. if [ ! -r ${srcdir}/tree.c ]
  70. then
  71.     if [ x$srcdirdefaulted = x ]
  72.     then
  73.       echo "$progname: Can't find compiler sources in \`${srcdir}'." 1>&2
  74.     else
  75.       echo "$progname: Can't find compiler sources in \`.' or \`..'." 1>&2
  76.     fi
  77.     exit 1
  78. fi
  79.  
  80. if [ x$machine != x ];
  81. then
  82.     case $machine in
  83.     vax)                    # for vaxen running bsd
  84.         ;;
  85.     vms)                    # for vaxen running VMS
  86.         cpu_type=vax
  87.         configuration_file=xm-${machine}.h
  88.         machine_type=${machine}
  89.         ;;
  90.     vax-sysv | vaxv)            # for vaxen running system V
  91.         cpu_type=vax
  92.         configuration_file=xm-vaxv.h
  93.         machine_type=vaxv
  94.         ;;
  95.     sequent-i386)            # for Intel 80386's on Sequent Symmetry
  96.         cpu_type=i386
  97.         configuration_file=xm-i386.h
  98.         machine_type=seq386
  99.         ;;
  100.     i386-sysv | i386v)        # for Intel 80386's running system V
  101.         machine=i386v
  102.         cpu_type=i386
  103.         configuration_file=xm-${machine}.h
  104.         machine_type=${machine}
  105.         ;;
  106.     i386-sysv-gas | i386g)
  107.         cpu_type=i386
  108.         configuration_file=xm-i386v.h
  109.         machine_type=i386gas
  110.         ;;        
  111.     i860)
  112.         ;;
  113.     next )
  114.         cpu_type=m68k
  115.         configuration_file=xm-m68k.h      
  116.         machine_type=next
  117.     ;;
  118.     sun4 | sun-4)
  119.         cpu_type=sparc
  120.         configuration_file=xm-sparc.h
  121.         machine_type=sun4os3
  122.         ;;
  123.     sun3 | sun-3)
  124.         cpu_type=m68k
  125.         configuration_file=xm-m68k.h
  126.         machine_type=sun3
  127.         ;;
  128.     sun3-nfp | sun-3-nfp)
  129.         cpu_type=m68k
  130.         configuration_file=xm-m68k.h
  131.         machine_type=sun3-nfp
  132.         ;;
  133.     sun3-fpa | sun-3-fpa)
  134.         cpu_type=m68k
  135.         configuration_file=xm-m68k.h
  136.         machine_type=sun3-fpa
  137.         ;;
  138.     sun2 | sun-2)
  139.         cpu_type=m68k
  140.         configuration_file=xm-m68k.h
  141.         machine_type=sun2
  142.         ;;
  143.     sun386 | sun386i | roadrunner)
  144.         cpu_type=i386
  145.         configuration_file=xm-sun386i.h
  146.         machine_type=sun386i
  147.         ;;
  148.     sun4-os4 | sun-4-os4)
  149.         cpu_type=sparc
  150.         target_machine=tm-sparc.h
  151.         machine_type=sparc
  152.         ;;
  153.     sun3-os4 | sun-3-os4)
  154.         cpu_type=m68k
  155.         configuration_file=xm-m68k.h
  156.         machine_type=sun3
  157.         ;;
  158.     sun3-nfp-os4 | sun-3-nfp-os4)
  159.         cpu_type=m68k
  160.         configuration_file=xm-m68k.h
  161.         machine_type=sun3-nfp
  162.         ;;
  163.     sun3-fpa-os4 | sun-3-fpa-os4)
  164.         cpu_type=m68k
  165.         configuration_file=xm-m68k.h
  166.         machine_type=sun3-fpa
  167.         ;;
  168.     sun2-os4 |sun-2-os4)
  169.         cpu_type=m68k
  170.         configuration_file=xm-m68k.h
  171.         machine_type=sun2
  172.         ;;
  173.     hp9k320)            # HP 9000 series 300 with gcc alone
  174.         cpu_type=m68k
  175.         configuration_file=xm-hp9k320.h
  176.         ;;
  177.     hp9k320-old)            # HP 9000 series 300 with gcc alone
  178.         cpu_type=m68k
  179.         target_machine=tm-hp9k32old.h
  180.         configuration_file=xm-hp9k320.h
  181.         ;;
  182.     hp9k320-gas | hp9k320g)            #    with gnu as, ld and gdb
  183.         cpu_type=m68k
  184.         configuration_file=xm-hp9k320.h
  185.         ;;
  186.     hp9k320-bsd | hp300)        # HP 9000/3xx running Berkeley Unix
  187.         cpu_type=m68k
  188.         target_machine=tm-hp9k3bsd.h
  189.         ;;
  190.     hp9k800)            # HP 9000 series 800 with g++ alone
  191.         cpu_type=hp9k8
  192.         configuration_file=xm-hp9k8.h
  193.         aux_output=out-hp9k8.c
  194.         machine_type=hp9k8
  195.         ;;
  196.     isi68)
  197.         cpu_type=m68k
  198.         ;;
  199.     news800)
  200.             configuration_file=xm-m68k.h
  201.             target_machine=tm-news.h
  202.         cpu_type=m68k
  203.         ;;
  204.     news-gas | news-g)
  205.             configuration_file=xm-m68k.h
  206.             target_machine=tm-newsgas.h
  207.         cpu_type=m68k
  208.         ;;
  209.     altos | altos3068)        # Altos 3068 with gnu as, ld and gdb
  210.             cpu_type=m68k
  211.             configuration_file=xm-altos3068.h
  212.             target_machine=tm-altos3068.h
  213.             ;;
  214.     3b1)
  215.         cpu_type=m68k
  216.         configuration_file=xm-${machine}.h
  217.         ;;
  218.     sequent-ns32k | sequent)
  219.         cpu_type=ns32k
  220.         aux_output=out-ns32k.c
  221.         ;;
  222.     encore)
  223.         cpu_type=ns32k
  224.         aux_output=out-ns32k.c
  225.         ;;
  226.     genix)
  227.         machine=ns32k
  228.         cpu_type=ns32k
  229.         configuration_file=xm-genix.h
  230.         ;;
  231.     88000)
  232.         cpu_type=m88k
  233.         machine_type=${cpu_type}
  234.         ;;
  235.     alliant)                # Alliant FX/8
  236.         ;;
  237.     convex-c1)                # Convex C1
  238.         machine_type=convex1
  239.         cpu_type=convex
  240.         ;;
  241.     convex-c2)                # Convex C2
  242.         machine_type=convex2
  243.         cpu_type=convex
  244.         ;;
  245.     pyr)
  246.         ;;
  247.     iris)                    # Mostly like a MIPS.
  248.         cpu_type=mips
  249.         target_machine=tm-iris.h
  250.         configuration_file=xm-iris.h
  251.         ;;
  252.     mips)                # Default MIPS environment
  253.         ;;
  254.     mips-sysv)            # SYSV variant of MIPS system.
  255.         cpu_type=mips
  256.         target_machine=tm-mips-sysv.h
  257.             ;;
  258.     mips-bsd43)            # BSD 4.3 variant of MIPS system.
  259.         cpu_type=mips
  260.         target_machine=tm-mips-bsd.h
  261.             ;;
  262.     dec-3100 | decstation)        # Decstation or pmax.
  263.         cpu_type=mips
  264.         target_machine=tm-decstatn.h
  265.             ;;
  266. #    370)
  267. #        machine=370
  268. #        ;;
  269.     GNUmasscomp)
  270.         cpu_type=m68k
  271.         target_machine=tm-GNUmass.h
  272.         ;;
  273.     masscomp)
  274.         cpu_type=m68k
  275.         machine_description=masscomp.md
  276.         ;;
  277.     esac
  278.  
  279.     $remove -f config.h tm.h md aux-output.c
  280.  
  281.         # if cpu_type is not set, define cpu_type to machine.
  282.         #
  283.     cpu_type=${cpu_type-$machine}
  284.     configuration_file=${configuration_file-xm-$cpu_type.h}
  285.     machine_type=${machine_type-$machine}
  286.     target_machine=${target_machine-tm-${machine_type}.h}
  287.     machine_description=${machine_description-${cpu_type}.md}
  288.     aux_output=${aux_output=out-$cpu_type.c}
  289.  
  290.     if [ xx${vint} = xx ]
  291.     then
  292.         files="$configuration_file $target_machine
  293.             $machine_description $aux_output"
  294.         links="config.h tm.h md aux-output.c"
  295.     else
  296.         files="$configuration_file tm-vmc.h $target_machine
  297.             $machine_description $aux_output"
  298.         links="config.h tm.h tm-pre.h md aux-output.c"
  299.     fi
  300.  
  301.     while [ -n "$files" ]
  302.     do
  303.         # set file to car of files, files to cdr of files
  304.         set $files; file=$1; shift; files=$*
  305.         set $links; link=$1; shift; links=$*
  306.  
  307.         if [ ! -r ${srcdir}/config/$file ]
  308.         then
  309.             echo "$progname: cannot create a link \`$link'," 1>&2
  310.             echo "since the file \`config/$file' does not exist." 1>&2
  311.             exit 1
  312.         fi
  313.  
  314.         $remove -f $link
  315.         rm -f config.status
  316.         # Make a symlink if possible, otherwise try a hard link
  317.         $symbolic_link ${srcdir}/config/$file $link 2>/dev/null || $hard_link ${srcdir}/config/$file $link
  318.  
  319.         if [ ! -r $link ]
  320.         then
  321.             echo "$progname: unable to link \`$link' to \`${srcdir}/config/$file'." 1>&2
  322.             exit 1
  323.         fi
  324.         echo "Linked \`$link' to \`${srcdir}/config/$file'."
  325.     done
  326.  
  327.     if [ xx${vint} = xx ]
  328.     then
  329.         echo "Links are now set up for use with a $machine." \
  330.             | tee config.status
  331.     else
  332.         echo "Links are now set up for use with a $machine (vint)." \
  333.             | tee config.status
  334.     fi
  335.  
  336.     # Install a makefile, and make it set VPATH
  337.     # if necessary so that the sources are found.
  338.     # Also change its value of srcdir.
  339.     # Also create a .gdbinit file which runs the one in srcdir
  340.     # and tells GDB to look there for source files.
  341.     case $srcdir in
  342.     .)
  343.         ;;
  344.     *)
  345.         echo "VPATH = ${srcdir}" > x
  346.         cat x ${srcdir}/Makefile | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile
  347.         rm x
  348.         echo "dir ${srcdir}" > .gdbinit
  349.         echo "source ${srcdir}/.gdbinit" >> .gdbinit
  350.         ;;
  351.     esac
  352.  
  353.     exit 0
  354. else
  355.     echo "Usage: $progname machine"
  356.     echo -n "Where \`machine' is something like "
  357.     echo "\`vax', \`sun3', \`umax', etc."
  358.     if [ -r config.status ]
  359.     then
  360.         cat config.status
  361.     fi
  362.     exit 1
  363. fi
  364.